package com.ff.xyh.feign.client.message;


import com.ff.xyh.common.entity.message.RoomMessage;
import com.ff.xyh.common.entity.result.ResultObject;
import com.ff.xyh.common.qo.message.RoomMessageQuery;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient(value = "service-message", contextId = "RoomMessageClient")
@RequestMapping("/message-service")
public interface RoomMessageClient {

    /**
     * 群聊消息 - 条件查询，包含分页
     * @param roomMessageQuery
     * @return
     */
    @PostMapping("get-room-message-condition")
    ResultObject getRoomMessageCondition(
            @RequestBody RoomMessageQuery roomMessageQuery) ;

    @PostMapping("get-all-message-room")
    ResultObject getAllMessageInRoom(
            @RequestParam(name = "roomId") String roomId) ;


    @ApiOperation(value = "分页查询群聊信息")
    @PostMapping("get-page-message-room")
    ResultObject getPageMessageInRoom(
            @RequestParam(name = "roomId") String roomId,
            @RequestParam(name = "currentPage") long currentPage,
            @RequestParam(name = "pageSize") long pageSize) ;

    @ApiOperation(value = "分页查询最先一条群聊信息前的消息")
    @PostMapping("get-page-message-room-before-id")
    ResultObject getPageMessageInRoomBeforeMessage(
            @RequestParam(name = "id") String id,
            @RequestParam(name = "roomId") String roomId,
            @RequestParam(name = "currentPage") long currentPage,
            @RequestParam(name = "pageSize") long pageSize) ;

    @ApiOperation(value = "分页查询群聊信息")
    @PostMapping("get-message-id")
    ResultObject getMessageById(
            @RequestParam(name = "id") String id) ;

    @PostMapping("add-message")
    ResultObject addMessage(
            @RequestBody RoomMessage roomMessage) ;

    @PostMapping("delete-message")
    ResultObject deleteMessageByIdAndUserId(
            @RequestParam(name = "id") String id,
            @RequestParam(name = "userId") String userId) ;


}

